package com.sky.service.impl;

import com.sky.constant.StatusConstant;
import com.sky.service.ShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class ShopServiceImpl implements ShopService {

    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public Integer getStatus() {
        Object status = redisTemplate.opsForValue().get("status");
        if (status != null) {
            log.info("status为：{}",Integer.parseInt(status.toString()));
            return Integer.parseInt(status.toString());
        }
        return null;
    }

    @Override
    public Integer updateStatus(Integer status) {

        redisTemplate.opsForValue().set("status",status.toString());

        return status;
    }
}
